package com.ruoyi.job.service;

import com.ruoyi.tb.lmt.service.ILifeService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zoubeibei
 * @date 2023年12月13日 14:55
 */
@Slf4j
@Service
public class lifeClientService {


    @Autowired
    private ILifeService iLifeService;

    /**
     * 定时监听客户端是否在线
     */
    @XxlJob("lifeClientJobHandler")
    public void lifeClientJobHandler() throws Exception {
        try{
            iLifeService.clientAlive();
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }

    }

    /**
     * 定时拉取数据
     */
    @XxlJob("pullingClientJobHandler")
    public void pullingClientJobHandler() throws Exception {
        try{
            iLifeService.pullingClient();
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
    }

    /**
     * 定时备份数据
     */
    @XxlJob("backupsClientJobHandler")
    public void backupsClientJobHandler() throws Exception {
        try{
            iLifeService.backupsClient();
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
    }

    /**
     * 定时拉取电子摆文件
     */
    @XxlJob("pullingClientFileJobHandler")
    public void pullingClientFileJobHandler() throws Exception {
        try{
            iLifeService.pullingClientFile();
        }catch (Exception e){
            e.printStackTrace();
            throw e;
        }
    }

}
